package common

import "regexp"

// VerifyMobile 手机号正则验证
func VerifyMobile(mobile string) bool {
	grepStr := `^1[35789]\d{9}$`
	result, _ := regexp.MatchString(grepStr, mobile)
	return result
}

// VerifyUserName 用户名正则验证
func VerifyUserName(username string) bool {
	grepStr := `^\w{6,12}$`
	result, _ := regexp.MatchString(grepStr, username)
	return result
}

// VerifyPassword 密码正则验证
func VerifyPassword(password string) bool {
	grepStr := `^\w{8,16}$`
	result, _ := regexp.MatchString(grepStr, password)
	return result
}

// VerifyEmail 邮箱正则验证
func VerifyEmail(email string) bool {
	grepStr := `^\w+@\w+[.](cn|com)$`
	result, _ := regexp.MatchString(grepStr, email)
	return result
}
